﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Raona.Code.Model
{
    [Serializable]
    public class Namespace
    {
        public Namespace()
        {
            this.Interfaces = new List<Interface>();
        }
        public string Name { get; set; }
        public List<Interface> Interfaces { get; set; }
        public string ClientInterfaceName
        {
            get
            {
                StringBuilder builder = new StringBuilder(this.Name);
                if (this.Name.Contains('.'))
                    builder.Insert(this.Name.IndexOf('.'), ".Client");
                else
                    builder.Insert(0, "Client.");
                return builder.ToString();
            }
        }
        public string ClientProxyName
        {
            get
            {
                string clientInterfaceName = this.ClientInterfaceName;
                StringBuilder builder = new StringBuilder(clientInterfaceName);
                if (clientInterfaceName.Contains(".Contracts"))
                    builder.Replace(".Contracts", null);
                else
                    builder.Append(".Proxies");
                return builder.ToString();
            }
        }
    }
}
